package org.grayrabbit.cms.component;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.StringUtils;


public class Rotate extends AbstractComponent{

	public  Map<String, String> loadparameterMap(String component,String[] ps){
		 
		
		Map<String,String> map = new HashMap<String,String>();
	 
		for(int i=0;i<ps.length;i=i+2){  
			String exp="";
			if("id".equalsIgnoreCase(ps[i])){
				if(StringUtils.isNotBlank(ps[i+1])) 
					exp="id='"+ps[i+1]+"'";			 
				map.put("id", exp);
			}else if("width".equalsIgnoreCase(ps[i])){
				if(StringUtils.isNotBlank(ps[i+1]))
					exp="width="+ps[i+1];
				map.put("width", exp);
			}else if("height".equalsIgnoreCase(ps[i])) {
				if(StringUtils.isNotBlank(ps[i+1]))
					exp = "height=" + ps[i+1];
				map.put("height", exp);
			}else if("interval".equalsIgnoreCase(ps[i])) {
				if(StringUtils.isNotBlank(ps[i+1]))
					exp = "interval=" + ps[i+1];
				map.put("interval", exp);
			}else if("target".equalsIgnoreCase(ps[i])) {
				if(StringUtils.isNotBlank(ps[i+1]))
					exp = "target='" + ps[i+1] + "'";
				map.put("target", exp);
			}else if("ads".equalsIgnoreCase(ps[i])) {
				if(StringUtils.isNotBlank(ps[i+1]))
					exp = "ads='" + ps[i+1] + "'";
				map.put("ads", exp);
			}else if("catIds".equalsIgnoreCase(ps[i])){
				if(StringUtils.isNotBlank(ps[i+1])) 
					exp="catIds="+ArrayToString(ps[i+1].split(","), true);
				map.put("catIds", exp);
			}else if("topicIds".equalsIgnoreCase(ps[i])) {
				if(StringUtils.isNotBlank(ps[i+1])) 
					exp = "topicIds=" + ArrayToString(ps[i+1].split(","), true);
				map.put("topicIds", exp);
			}else if("adIds".equalsIgnoreCase(ps[i])) {
				if(StringUtils.isNotBlank(ps[i+1]))
					exp = "adIds=" + ArrayToString(ps[i+1].split(","), true);
				map.put("adIds", exp);
			}else if("size".equalsIgnoreCase(ps[i])) {
				if(StringUtils.isNotBlank(ps[i+1]))
					exp = "size=" + ps[i+1];
				map.put("size", exp);
			}
		} 
		return map;
	}
}
